Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Water Content Measurement clusters #59300

Merged
merged 3 commits into from
Nov 8, 2021
Merged

Add Water Content Measurement clusters #59300

merged 3 commits into from
Nov 8, 2021

Conversation

majkrzak
Copy link
Contributor

@majkrzak majkrzak commented Nov 7, 2021

Proposed change

Ads missing Water Content Measurement clusters: Soil Moisture and Leaf Wetness

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

It requires zigpy/zigpy#844 to be first pulled into the core.
The Soil Moisture part was tested with https://github.com/smartboxchannel/Plant-Watering-Sensor-Zigbee, and seems to be working. Leaf Moisture was not tested, but according to the zcl specs it should behave in the very same way.
I think that I have added new clusters in all the places they are supposed to be.
Requires #59314 to be merged first.

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 馃 Silver
  • 馃 Gold
  • 馃弳 Platinum

To help with the load of incoming pull requests:

@probot-home-assistant
Copy link

Hey there @dmulcahey, @Adminiuga, mind taking a look at this pull request as it has been labeled with an integration (zha) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@project-bot project-bot bot added this to Needs review in Dev Nov 7, 2021
Copy link
Contributor

@Adminiuga Adminiuga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm. Can you post the device signature?
I'd like to add it to the list of test devices

@majkrzak
Copy link
Contributor Author

majkrzak commented Nov 7, 2021

@Adminiuga do you meen this?

{
  "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress: 128>, manufacturer_code=0, maximum_buffer_size=80, maximum_incoming_transfer_size=160, server_mask=0, maximum_outgoing_transfer_size=160, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)",
  "endpoints": {
    "1": {
      "profile_id": 260,
      "device_type": "0x000c",
      "in_clusters": [
        "0x0000",
        "0x0001",
        "0x0402",
        "0x0408"
      ],
      "out_clusters": []
    }
  },
  "manufacturer": "efektalab.ru",
  "model": "EFEKTA_PWS",
  "class": "zigpy.device.Device"
}```

@majkrzak
Copy link
Contributor Author

majkrzak commented Nov 7, 2021

About "lgtm": it requires the zigpy version to be bumped correctly in the manifest, as now it will most likely crash the component due to the measurement.SoilMoisture.cluster_id for example.

@Adminiuga
Copy link
Contributor

Yes. I'll add it to the test ZigBee devices list tonight, as I think this is a first such device in the list.

@Adminiuga
Copy link
Contributor

About "lgtm": it requires the zigpy version to be bumped correctly in the manifest, as now it will most likely crash the component due to the measurement.SoilMoisture.cluster_id for example.

yeah, need to publish zigpy and bump up ZHA dependencies first.

@Adminiuga Adminiuga mentioned this pull request Nov 7, 2021
22 tasks
@Adminiuga
Copy link
Contributor

can you add the following diff to your PR? Or I could submit a PR to your branch

--- a/tests/components/zha/zha_devices_list.py
+++ b/tests/components/zha/zha_devices_list.py
@@ -3985,4 +3985,42 @@ DEVICES = [
         SIG_MODEL: "XBee3",
         SIG_NODE_DESC: b"\x01@\x8e\x1e\x10R\xff\x00\x00,\xff\x00\x00",
     },
+    {
+        DEV_SIG_DEV_NO: 99,
+        SIG_ENDPOINTS: {
+            1: {
+                SIG_EP_TYPE: 0x000c,
+                DEV_SIG_EP_ID: 1,
+                SIG_EP_INPUT: [0x0000, 0x0001, 0x0402, 0x0408],
+                SIG_EP_OUTPUT: [],
+                SIG_EP_PROFILE: 260,
+            }
+        },
+        DEV_SIG_ENTITIES: [
+            "sensor.efektalab_ru_efekta_pws_77665544_power",
+            "sensor.efektalab_ru_efekta_pws_77665544_temperature",
+            "sensor.efektalab_ru_efekta_pws_77665544_soil_moisture",
+        ],
+        DEV_SIG_ENT_MAP: {
+            ("sensor", "00:11:22:33:44:55:66:77-1-1"): {
+                DEV_SIG_CHANNELS: ["power"],
+                DEV_SIG_ENT_MAP_CLASS: "Battery",
+                DEV_SIG_ENT_MAP_ID: "sensor.efektalab_ru_efekta_pws_77665544_power",
+            },
+            ("sensor", "00:11:22:33:44:55:66:77-1-1026"): {
+                DEV_SIG_CHANNELS: ["temperature"],
+                DEV_SIG_ENT_MAP_CLASS: "Temperature",
+                DEV_SIG_ENT_MAP_ID: "sensor.efektalab_ru_efekta_pws_77665544_temperature",
+            },
+            ("sensor", "00:11:22:33:44:55:66:77-1-1032"): {
+                DEV_SIG_CHANNELS: ["soil_moisture"],
+                DEV_SIG_ENT_MAP_CLASS: "SoilMoisture",
+                DEV_SIG_ENT_MAP_ID: "sensor.efektalab_ru_efekta_pws_77665544_soil_moisture",
+            },
+        },
+        DEV_SIG_EVT_CHANNELS: [],
+        SIG_MANUFACTURER: "efektalab.ru",
+        SIG_MODEL: "EFEKTA_PWS",
+        SIG_NODE_DESC: b"\x02@\x80\x00\x00P\xa0\x00\x00\x00\xa0\x00\x00",
+    },
 ]

@Adminiuga
Copy link
Contributor

once #59314 gets merged, rebase against the dev.

@Adminiuga
Copy link
Contributor

ZHA dependencies were updated. Please rebase against the current upstream dev and force push.

@majkrzak
Copy link
Contributor Author

majkrzak commented Nov 8, 2021

can you add the following diff to your PR? Or I could submit a PR to your branc
ZHA dependencies were updated. Please rebase against the current upstream dev and force push.
@Adminiuga done

Copy link
Contributor

@Adminiuga Adminiuga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

Dev automation moved this from Needs review to Reviewer approved Nov 8, 2021
@Adminiuga Adminiuga merged commit 80f1e87 into home-assistant:dev Nov 8, 2021
Dev automation moved this from Reviewer approved to Done Nov 8, 2021
@majkrzak majkrzak deleted the zha/add-water-content branch November 8, 2021 18:47
@github-actions github-actions bot locked and limited conversation to collaborators Nov 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants